import { createGameModule } from "@sapi-game/createGameModule";
import { GameContext } from "@sapi-game/gameContext";
import { TTLPlayer } from "@sapi-game/gamePlayer/gamePlayer";
import { PlayerGroup } from "@sapi-game/gamePlayer/playerGroup";
import { PillarOfFortuneMap } from "./map";
import { CubeRegion } from "@sapi-game/gameRegion/gameRegion";

export class PillarOfFortuneContext extends GameContext {
    readonly players: PlayerGroup<PillarOFFortunePlayer>;
    readonly map: PillarOfFortuneMap;
    readonly outSetRegion: CubeRegion;

    constructor(
        players: PlayerGroup<PillarOFFortunePlayer>,
        config: { map: PillarOfFortuneMap }
    ) {
        super();
        this.players = players;
        this.map = config.map;
        this.outSetRegion = this.map.region.outSet({ x: 5, y: 2, z: 5 });
    }
}

export class PillarOFFortunePlayer extends TTLPlayer {
    alive: boolean = true;
    lastDamageTick: number = 0;
    lastDamagePlayer?: PillarOFFortunePlayer;
}

export const PillarOfFortuneModule = createGameModule({
    contextClass: PillarOfFortuneContext,
    playerClass: PillarOFFortunePlayer,
});
